package ioc16;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class SomeBean implements InitializingBean, DisposableBean, BeanNameAware, BeanFactoryAware, ApplicationContextAware {

    private String str;

    public SomeBean() {
        System.out.println("SomeBean.SomeBean()---实例化");
    }
    public void setStr(String str) {
        System.out.println("SomeBean.setStr()---DI");
        this.str = str;
    }
    @Override
    public void setBeanName(String s) {
        System.out.println("SomeBean.setBeanName()---BeanNameAware的setBeanName方法");
    }
    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("SomeBean.setBeanFactory()---BeanFactoryAware的setBeanFactory方法");
    }
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("SomeBean.setApplicationContext()---ApplicationContextAware的setApplicationContext方法");
    }
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("SomeBean.afterPropertiesSet()---afterPropertiesSet方法");
    }
    public void myInit(){
        System.out.println("SomeBean.myInit()---初始化方法");
    }
    public void doSome(){
        System.out.println("SomeBean.doSome()---使用");
    }
    @Override
    public void destroy() throws Exception {
        System.out.println("SomeBean.destroy()---destroy方法");
    }
    public void myDistroy(){
        System.out.println("SomeBean.myDistroy()---销毁方法");
    }






    public String getStr() {
        return str;
    }



}
